from PyQt6.QtWidgets import QWidget, QLabel, QVBoxLayout


class TotalCostDisplayWidget(QWidget):
    """总成本显示部件"""

    def __init__(self, parent=None):
        super().__init__(parent)
        self.init_ui()

    def init_ui(self):
        """初始化用户界面"""
        layout = QVBoxLayout(self)

        self.cost_label = QLabel("总成本: 0.00 元")
        self.cost_label.setStyleSheet("font-size: 24px; font-weight: bold; color: #d9534f;")
        layout.addWidget(self.cost_label)

    def update_display(self, total_cost):
        """更新显示"""
        self.cost_label.setText(f"总成本: {total_cost:.2f} 元")